SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE VIEW dbo.vwrDocumentosPendientes
AS
SELECT     IdDocumentacion AS ID, COUNT(IdDocumentacionMovimientos) AS Pendientes, FechaSalida
FROM         dbo.tb_DocumentacionMovimientos
GROUP BY IdDocumentacion, FechaSalida
HAVING      (FechaSalida IS NULL)


GO
GRANT SELECT ON  [dbo].[vwrDocumentosPendientes] TO [GestionDespacho]
GRANT SELECT ON  [dbo].[vwrDocumentosPendientes] TO [Informatica]
GRANT SELECT ON  [dbo].[vwrDocumentosPendientes] TO [SoloVer]
GO
